Skip to content

Bump omniauth and hashie versions#18

Merged
tramuntanal merged 4 commits intomasterfrom
dep/bump_omniauth_to_v2.1
Jan 27, 2026
Merged

Bump omniauth and hashie versions#18
tramuntanal merged 4 commits intomasterfrom
dep/bump_omniauth_to_v2.1

Conversation

@tramuntanal
Copy link
Copy Markdown
Collaborator

@tramuntanal tramuntanal commented Jan 21, 2026

🎩 What? Why?

This gem stopped working when applications were accessing the AuthHash (which contains :info, :provider, etc.) were accessing the values with keys of Symbol type, instead of String. i.e.: The following code ah= OmniAuth::AuthHash.new(provider: :idcat_mobil); ah.slice :provider was returning an empty Hash, {}, instead of #<OmniAuth::AuthHash provider=:idcat_mobil>.

This is because OmniAuth::AuthHash refused to use old Hashie in favor of the standard Hash class. With Hashie v5.0.0 OmniAuth::AuthHash uses Hashie again.

# expected behavior to access `ah` with either string or symbol keys
ah= OmniAuth::AuthHash.new(provider: :idcat_mobil)
ah.method(:slice)
=> #<Method: OmniAuth::AuthHash(Hashie::Mash)#slice(*keys)
ah.slice :provider
=> {"provider"=>:idcat_mobil}

# only accepts string keys
ah= OmniAuth::AuthHash.new(provider: :idcat_mobil)
ah.method(:slice).inspect
=> "#<Method: OmniAuth::AuthHash(Hash)#slice(*)>"
ah.slice(:provider, :uid, :info)
=> {}

The stacktrace in production is:

WARN -- : [a34b1258-18e6-4d3d-9ac7-0ad4495e310d] You are setting a key that conflicts with a built-in method SnakyHash::StringKeyed#method defined in Kernel. This can cause unexpected behavior when accessing the key as a property. You can still access the key via the #[] method.
INFO -- : [a34b1258-18e6-4d3d-9ac7-0ad4495e310d] Processing by Decidim::Devise::OmniauthRegistrationsController#idcat_mobil as HTML
INFO -- : [a34b1258-18e6-4d3d-9ac7-0ad4495e310d]   Parameters: {"code"=>"[FILTERED]", "state"=>"a654797f2bfd605c46d9c3c2e1b835d94c007b86a3c68c36"}
INFO -- : [a34b1258-18e6-4d3d-9ac7-0ad4495e310d] Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms | Allocations: 794)
ERROR -- : [a34b1258-18e6-4d3d-9ac7-0ad4495e310d] @app.call rescued from: undefined method `with_indifferent_access' for nil:NilClass => .../decidim-core/lib/decidim/attribute_object/form.rb:82:in `hash_from'
.../decidim-core/lib/decidim/attribute_object/form.rb:72:in `from_params'
.../decidim-core/app/controllers/concerns/decidim/form_factory.rb:65:in `from_params'
.../decidim-core/app/controllers/decidim/devise/omniauth_registrations_controller.rb:18:in `create'
.../decidim-core/app/controllers/decidim/devise/omniauth_registrations_controller.rb:50:in `action_missing'
...

@tramuntanal tramuntanal self-assigned this Jan 21, 2026
@laurajaime
Copy link
Copy Markdown
Collaborator

@tramuntanal can you add the crash log in description?

@tramuntanal tramuntanal merged commit 53a3a3b into master Jan 27, 2026
2 checks passed
@tramuntanal tramuntanal deleted the dep/bump_omniauth_to_v2.1 branch January 27, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants